WARNING: This program has a bug, which means we need to fix it!

If an event function doesn't have any code indented underneath, the program will throw an error.

  • Click Run and read the error message.
  • Debug the program so your micro:bit outputs the amount of light it senses every four seconds.

Hint: We need to indent two lines of code to make this program run correctly.

To navigate the page using the TAB key, first press ESC to exit the code editor.

stage.set_background("city") microbit = codesters.Microbit() def interval(): light = microbit.get_light() microbit.show_number(light) stage.event_interval(interval, 4)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)